package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import dao.ContactDAO;
import dao.StudentDAO;
import model.Contact;
import model.Student;

public class ContactAction {
	private Contact contact;
	private ContactDAO dao=new ContactDAO();
	private StudentDAO sdao=new StudentDAO();
	public Contact getContact() {
		return contact;
	}

	public void setContact(Contact contact) {
		this.contact = contact;
	}
	
	public String update() {
		dao.updatr(contact);
		HttpServletRequest req=ServletActionContext.getRequest();
		HttpSession session=req.getSession();
		Student student=(Student) session.getAttribute("STUDENT");
		student.setContact(contact);
		sdao.update(student);
		return "main";
	}
}
